package cn.edu.nwsuaf.studentcenter.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * ExamItem entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "exam_item", catalog = "exam")
public class ExamItem implements java.io.Serializable {

	// Fields

	private String examItemNo;
	private Teacher teacher;
	private ExamItemType examItemType;
	private String examItemDescription;
	private String examItemContent;
	private String examItemAnswer;
	private String examItemAnalysis;
	private Integer examItemLevel;
	private Set<ExamContent> examContents = new HashSet<ExamContent>(0);

	// Constructors

	/** default constructor */
	public ExamItem() {
	}

	/** minimal constructor */
	public ExamItem(String examItemNo, Teacher teacher,
			ExamItemType examItemType, Integer examItemLevel) {
		this.examItemNo = examItemNo;
		this.teacher = teacher;
		this.examItemType = examItemType;
		this.examItemLevel = examItemLevel;
	}

	/** full constructor */
	public ExamItem(String examItemNo, Teacher teacher,
			ExamItemType examItemType, String examItemDescription,
			String examItemContent, String examItemAnswer,
			String examItemAnalysis, Integer examItemLevel,
			Set<ExamContent> examContents) {
		this.examItemNo = examItemNo;
		this.teacher = teacher;
		this.examItemType = examItemType;
		this.examItemDescription = examItemDescription;
		this.examItemContent = examItemContent;
		this.examItemAnswer = examItemAnswer;
		this.examItemAnalysis = examItemAnalysis;
		this.examItemLevel = examItemLevel;
		this.examContents = examContents;
	}

	// Property accessors
	@Id
	@Column(name = "exam_item_no", unique = true, nullable = false, length = 50)
	public String getExamItemNo() {
		return this.examItemNo;
	}

	public void setExamItemNo(String examItemNo) {
		this.examItemNo = examItemNo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "teacher_no", nullable = false)
	public Teacher getTeacher() {
		return this.teacher;
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "exam_item_type_no", nullable = false)
	public ExamItemType getExamItemType() {
		return this.examItemType;
	}

	public void setExamItemType(ExamItemType examItemType) {
		this.examItemType = examItemType;
	}

	@Column(name = "exam_item_description", length = 1024)
	public String getExamItemDescription() {
		return this.examItemDescription;
	}

	public void setExamItemDescription(String examItemDescription) {
		this.examItemDescription = examItemDescription;
	}

	@Column(name = "exam_item_content", length = 1024)
	public String getExamItemContent() {
		return this.examItemContent;
	}

	public void setExamItemContent(String examItemContent) {
		this.examItemContent = examItemContent;
	}

	@Column(name = "exam_item_answer", length = 1024)
	public String getExamItemAnswer() {
		return this.examItemAnswer;
	}

	public void setExamItemAnswer(String examItemAnswer) {
		this.examItemAnswer = examItemAnswer;
	}

	@Column(name = "exam_item_analysis", length = 1024)
	public String getExamItemAnalysis() {
		return this.examItemAnalysis;
	}

	public void setExamItemAnalysis(String examItemAnalysis) {
		this.examItemAnalysis = examItemAnalysis;
	}

	@Column(name = "exam_item_level", nullable = false)
	public Integer getExamItemLevel() {
		return this.examItemLevel;
	}

	public void setExamItemLevel(Integer examItemLevel) {
		this.examItemLevel = examItemLevel;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "examItem")
	public Set<ExamContent> getExamContents() {
		return this.examContents;
	}

	public void setExamContents(Set<ExamContent> examContents) {
		this.examContents = examContents;
	}

}